#include <logger.h>
#include "iec101device.h"

#define VERSION "V1.00"

extern "C" {

IDevice * CreateDevice(const char *protocol, uint16_t bay_id, uint16_t dev_id, IPhyLink *phy_dev)
{
    if (strcmp(protocol, "iec101") == 0)
        return new IEC101Device(bay_id, dev_id, phy_dev);

    log_info("not support protocol:%s\n", protocol);
    return nullptr;
}

void ReleaseDevice(IDevice *dev)
{
    if (dev) {
        delete dev;
    }
}

const char * GetVersion(void)
{
    static std::string ver;
    if (ver.empty()) {
        ver = VERSION ",";
        ver += __DATE__ "," __TIME__;
    }
    return ver.c_str();
}

}
